# -!- coding: utf-8 -!-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#文件：postCrcs.py
触发crcs征信平台的接口
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

import requests

from interfacetest.baseset.risk_control_api import API_RISK
from pycacho.cachobase.logger import Logger

logger = Logger("postCrcs").get_log()


url = 'https://test.credit.msxiaodai.com'

headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36',
            'content-Type': 'application/json',
        }


def aviationReport():
    fu_url = url + '/tianchuang/aviationReport'
    data = API_RISK['tianchuang']['aviationReport']
    data['month'] = '12'
    print(fu_url)
    req1 = requests.post(fu_url, json=data, headers=headers)
    data = req1.text
    logger.info("旅行信息－分析出行报告_航空接口响应信息：%s", data)


def railwayReport():
    fu_url = url + '/tianchuang/railwayReport'
    data = API_RISK['tianchuang']['railwayReport']
    data['type'] = 'ST'
    data['parameter'] = None
    req1 = requests.post(fu_url, json=data, headers=headers)
    data = req1.text
    logger.info("旅行信息－分析出行报告_铁路V2接口响应信息：%s", data)


def consumingProbe():
    fu_url = url + '/tianchuang/consumingProbe'
    data = API_RISK['tianchuang']['consumingProbe']
    req1 = requests.post(fu_url, json=data, headers=headers)
    data = req1.text
    logger.info("综合信息－消费探针V2.0接口响应信息：%s", data)


def consumptionVariables():
    fu_url = url + '/tianchuang/consumptionVariables'
    data = API_RISK['tianchuang']['consumptionVariables']
    req1 = requests.post(fu_url, json=data, headers=headers)
    data = req1.text
    logger.info("综合信息_消费计算变量模型接口响应信息：%s", data)


if __name__ == '__main__':
    #aviationReport()
    #railwayReport()
    consumingProbe()
    #consumptionVariables()